<template name="popupList">
	<div class="rc-popup-list">
		{{> Template.dynamic config }}
	</div>
</template>

<template name="popupList_default">
	<ul class="rc-popup-list__list">
		{{#if loading}}
			{{> popupList_loading }}
		{{else}}
			{{#each item in items}}
				{{> Template.dynamic config item data=data}}
			{{else}}
				{{> Template.dynamic template=noMatchTemplate}}
			{{/each}}
		{{/if}}
	</ul>
</template>

<template name="popupList_item_default">
	<li class="rc-popup-list__item">
		 <span class="rc-popup-list__item-image">
			 {{>avatar username=item.username}}
		 </span>
		 {{#if showRealNames}}
		 	<span class="rc-popup-list__item-name">{{{modifier item.name}}}{{#if item.nickname}} ({{{modifier item.nickname}}}){{/if}} ({{{modifier item.username}}})</span>
		 {{else}}
		 	<span class="rc-popup-list__item-name">{{{modifier item.username}}}{{#if item.nickname}} ({{item.nickname}}){{/if}}</span>
		 {{/if}}
	</li>
</template>

<template name="popupList_loading">
	<p>{{_ "Loading"}}.</p>
</template>

<template name="popupList_item_channel">
	 <li class="rc-popup-list__item">
		 <span class="rc-popup-list__item-image">
			 {{>avatar username=item.name roomIcon=true}}
		 </span>
		 <span class="rc-popup-list__item-name">{{{modifier item.name}}}</span>
	</li>
</template>

<template name="popupList_item_custom">
	<li class="rc-popup-list__item">
		<span class="rc-popup-list__item-image">
			{{>avatar username=item.custom_name roomIcon=true}}
		</span>
		<span class="rc-popup-list__item-name">{{{modifier item.custom_name}}}</span>
	</li>
</template>
